package com.java复习.练习二;

public class Ploygon {
    private int sides;  //多边形的边数
    private double area;  // 多边形的面积

    public int getSides() {
        return sides;
    }

    public void setSides(int sides) {
        this.sides = sides;
    }

//    public double getArea() {
//        return area;
//    }

    public void setArea(double area) {
        this.area = area;
    }

    public int getNumberOfSides(){
        System.out.println(sides);
        return sides;
    }

    @Override
    public String toString() {
        System.out.println("这是一个"+sides+"边形，"+"有"+sides+"个边");
        return "Ploygon{" +
                "sides=" + sides +
                ", area=" + area +
                '}';
    }


    //构造器
    public Ploygon(int sides){
        this.sides = sides;
        System.out.println("在Ploygon类的构造器中");
    }


}

